<%@ include file="/WEB-INF/jsp/include.jsp"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<c:url var="addNewComponent" value="/admin/addComponent" />
<c:url var="buttonBackComponents" value="/admin/components/pages/1" />

<form:form class="form-signin" name="formNewComponent"
	action="${addNewComponent}" method="POST"
	modelAttribute="bindableComponent"
	commandName="bindableComponent">

	<form:label path="componentName">Component name</form:label>
	<form:input path="componentName" type="text" />
	<form:errors path="componentName" />
    
	<form:label path="componentType">Component type</form:label>
	<form:select path="componentType" type="select" onchange="showHiddenComponentData('componentType')">
	   <form:option value="Firewall" selected="selected" >Firewall      </form:option>
	   <form:option value="HardDisk"                     >Hard disk     </form:option>
	   <form:option value="NetworkCard"                  >Network card  </form:option>
	   <form:option value="PowerSupply"                  >Power supply  </form:option>
	   <form:option value="RamMemory"                    >Ram memory    </form:option>
	   <form:option value="Processor"                    >Processor     </form:option>
	</form:select>
	<form:errors path="componentType" />

	<form:label path="energyToTurnOn">Energy to turn ON</form:label>
	<form:input path="energyToTurnOn" type="text" />
	<form:errors path="energyToTurnOn" />

	<form:label path="prize">Price</form:label>
	<form:input path="prize" type="text" />
	<form:errors path="prize" />

    <div id="firewallData" class="" >
	   <form:label path="dificultAccess">Difficult access</form:label>
	   <form:input path="dificultAccess" type="text" />
	   <form:errors path="dificultAccess" />
    </div>
    
    <div id="hd_RamData" class="div_info_hidden" >
	   <form:label path="totalCapacity">Total capacity</form:label>
	   <form:input path="totalCapacity" type="text" />
	   <form:errors path="totalCapacity" />
    </div>
    
    <div id="networkCardData" class="div_info_hidden" >
	   <form:label path="speedConection">Speed connection</form:label>
	   <form:input path="speedConection" type="text" />
	   <form:errors path="speedConection" />
	</div>
	
	<div id="powerSupplyData" class="div_info_hidden" >
	   <form:label path="generatedEnergy">Generated energy</form:label>
        <form:input path="generatedEnergy" type="text" />
        <form:errors path="generatedEnergy" />
    </div>
    
    <div id="processorData" class="div_info_hidden" >
        <form:label path="speedForCore">Speed for core</form:label>
        <form:input path="speedForCore" type="text" />
        <form:errors path="speedForCore" />
    
        <form:label path="cores">Cores</form:label>
        <form:input path="cores" type="text" />
        <form:errors path="cores" />
    </div>
    
    <div id="formAddComponentBottomButtons" >
	   <button type="submit" class="btn btn-primary">Add new component</button>

	   <a href="${buttonBackComponents}" class="btn btn-primary"><i
		  class="icon-plus icon-white"></i> Back</a>
    </div>
</form:form>

<c:if test="${not empty sucess}">
	<c:if test="${sucess == true}">
		<p>sucess</p>
	</c:if>
	<c:if test="${sucess == false}">
		<p>error</p>
	</c:if>
</c:if>